import Vue from "vue";
import VueRouter from "vue-router";

// 1. 定义 (路由) 组件。
// 可以从其他文件 import 进来

import Main from "@/views/Main.vue";

import Login from "@/views/Login.vue";
import NotPage from "@/views/NotPage.vue";
Vue.use(VueRouter);

// 2. 定义路由
const routes = [
  {
    path: "/",
    component: Main,
    name: "main",
    redirect: "/home",
    children: [
      /*  {
        path: "home",
        name: "home",
        component: Home, //首页
      },
      {
        path: "user",
        name: "user",
        component: User, //用户管理页面
      },
      {
        path: "mall",
        name: "mall",
        component: Mall, //商品管理页面
      },
      {
        path: "page1",
        name: "page1",
        component: PageOne, //页面1
      },
      {
        path: "page2",
        name: "page2",
        component: PageTwo, //页面2
      }, */
    ],
  },
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "*",
    component: NotPage,
  },
];

// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
  routes, // (缩写) 相当于 routes: routes
});

// 4.导出路由
export default router;
